<template>
    <view>
        <view v-if="agreement_list.length!==0">
            <view v-for="(item,index) in agreement_list" :key="index" class="agreement_list">
                <view class="list_1">
                    <view class="title">{{item.show_name}}</view>
                    <view class="time">签署时间：{{item.created_at}}</view>
                </view>
                <view class="list2">
<!--                        <button @tap="watchDetail(item)" class="watch_button">查看</button>-->
                        <button  class="watch_button">查看</button>
                </view>
            </view>

        </view>
        <view v-else>
            <MnoData></MnoData>
        </view>
        <m-bottom></m-bottom>
    </view>

</template>

<script>
    import MnoData from '@/components/m-noData.vue'
    export default {
        name: "myAgreement",
        data() {
            return {
                agreement_list:[],
                page:1,
                is_load:0,
                webviewStyles: {
                    progress: {
                        color: '#FF3333'
                    }
                }

            }
        },
        mounted() {
            this.myProtocol()
        },
        onReachBottom() {  //分页加载请求数据
            if(this.is_load>0){
                this.page++
                setTimeout(()=>{
                    this.myProtocol()
                },1000)
            }else{
                uni.showToast({
                    title:"没有更多数据啦",
                    icon:"none",
                })
            }

        },
        methods: {
            async myProtocol(){
                uni.showLoading({})
                let resData = await this.$apis.myProtocol({page:this.page})
                console.log(resData)
                if(resData.code===0){
                    this.agreement_list.push(...resData.data.lists)
                    this.is_load=resData.data.is_load
                }
                uni.hideLoading()
            },
            watchDetail(item){ //查看签署
                console.log(item)
                this.$router.push({
                    route:this.$routesConfig.watchAgreement,
                    query:{sign_url:item.sign_url}
                })
            }

        },
        components:{
            MnoData
        }

    }
</script>
<style>
    page {
        background-color:#FAFAFA
    }
</style>
<style lang="less" scoped>
    .empty_img{
        width: 520rpx;
        height: 360rpx;
        margin-top: 200rpx;
    }
    .empty_text{
        color: #333333;
        font-size: 26rpx;
        margin-top: 20rpx;
    }
    .empty_box{
        text-align: center;
    }
    .agreement_list{
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }
    .watch_button{
        border:  none;
        background-color: #FF9502;
        line-height: 2.3;
        width: 130rpx;
        height: 60rpx;
        color: #ffffff;
        font-size: 26rpx;
        margin-top: 20rpx;
    }
    .title{
        font-size: 28rpx;
        color: #333333;
    }
    .time{
        font-size: 24rpx;
        color: #999999;
        margin-top: 20rpx;
    }
    .agreement_list{
        background-color: #ffffff;
        padding-left: 20rpx;
        padding-right: 20rpx;
        padding-top: 20rpx;
        padding-bottom: 20rpx;
        margin-bottom: 20rpx;
        margin-top: 20rpx;
    }

</style>
